#include "HelloWorld1.h"
#include "NFComm/NFCore/NFProfiler.h"

bool NFCHelloWorld1::Init()
{
    m_pThread = new HelloThread();
    m_pLogModule = pPluginManager->FindModule<NFILogModule>();
    return true;
}

bool NFCHelloWorld1::AfterInit()
{
    std::cout << "Start Thread" << std::endl;
    m_pThread->StartThread();
    return true;
}

bool NFCHelloWorld1::Execute()
{

    return true;
}

bool NFCHelloWorld1::TestLogModule()
{
    static bool run = false;
    if (run)
    {
        return true;
    }

    run = true;

    BEGIN_PROFILE("test log");
    for (int i = 0; i < 10000; i++)
    {
        //m_pLogModule->LogNormal(NFILogModule::NLL_INFO_NORMAL, NFGUID(), "fuck", "your mother " + lexical_cast<std::string>(i), __FUNCTION__, __LINE__);
    }
    END_PROFILE();

    std::cout << "finish" << std::endl;
    return true;
}

bool NFCHelloWorld1::BeforeShut()
{
    std::cout << "Stop Thread" << std::endl;
    m_pThread->StopThread();
    delete m_pThread;
    m_pThread = nullptr;
    return true;
}

bool NFCHelloWorld1::Shut()
{

    return true;
}

bool NFCHelloWorld1::Finalize()
{
    return true;
}
